<!DOCTYPE html>
<html>

<head>
	<title></title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="../res/css/weui.css" />
	<link rel="stylesheet" href="../res/css/weuix.css" />
	<link rel="stylesheet" href="../res/css/common.css" />
	<script src="../res/js/zepto.min.js"></script>
	<script src="../res/js/zepto.weui.js"></script>
	<script src="../res/js/common.js?v=1"></script>
	<script src="../res/js/socket.js"></script>
	<script type="text/javascript">
		//tabbar跳转
		function tabbargo(openid, orgid) {
			$('.weui-tabbar__item').on('click', function () {
				var type = $(this).attr("id");
				console.log(type);
				if (type == "inquiry_index") {
					location.href = "inquiry_doctor_index.htm?orgid=" + orgid + "&openid=" + openid
				} else if (type == "inquiry_doctor") {
					if (!isLogin()) {
						$.confirm("请先登录再操作", function () {
							goPage('login.htm');
						}, function () {
							//取消操作
						});
					} else {
						location.href = "inquiry_doctor.htm?orgid=" + orgid + "&openid=" + openid
					}
				} else if (type == "my_doctor_index") {
					if (!isLogin()) {
						$.confirm("请先登录再操作", function () {
							goPage('login.htm');
						}, function () {
							//取消操作
						});
					} else {
						location.href = "my_doctor_index.htm?orgid=" + orgid + "&openid=" + openid
					}
				} else {
					location.href = "inquiry_user_personal.htm?orgid=" + orgid + "&openid=" + openid;
				}
			});
		}

		function setUserInfo() {
			var userInfoData = getUserInfo();
			if (isLogin()) {
				newGetInfo()
			} else {
				$('#userInfo').on('click', function () {
					goPage('login.htm');
				})
			}
		}
		// ------------------------3.30
		var openid = getQst("openid").trim();
		var orgid = getQst("orgid").trim();
		$(function () {
			tabbargo(openid, orgid);
			if(isHis){
				// 这一版暂不做
				// $("#examination_report").show()
			}
			if(isChengDu){
				$("#patients_list").css('display', 'flex')
			}
			if(!isFreeBilling){
				$("#inquire_report").css('display', 'none')
			}
			// ------------------------3.30
			setUserInfo()
			// 跳转我的问诊
			$('#my_inquiry').click(function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage('my_inquiry.htm?user_id=' + user_id);
				}
			});
			// 跳转我的处方
			var user_id = getUserId();
			$('#my_recipe').on("click", function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage('recipe_list.htm?user_id=' + user_id)
				}
				// goPage('https://agedplay.yst.aisee.tv/yljh5/oldmanpublic2/views/prescription/prescription.html?openid='+openid);
				// goPage("https://agedplay.yst.aisee.tv/yljh5/oldmanpublic2/views/prescription/prescription.html?user_id="+getUserId());
			});
			// 跳转我的订单
			$('#my_order').on("click", function (e) {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage('order_center.htm?orgid=' + orgid + '&openid=' + openid + '&user_id=' + user_id +
						'&isIndex=0');
				}
			});
			//跳转到检查检验订单
			$('#examination_report').on("click", function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage('inspection.htm?orgid=' + orgid + '&openid=' + openid + '&user_id=' + user_id +
						'&isIndex=0');
				}
			});
			//跳转到查询报告
			$('#inquire_report').on('click', function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage("inuqiry_user_report.htm");
				}
			})
			//跳转到就诊人管理
			$('#patients_list').on('click', function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage("case_list.htm");
				}
			})
			//跳转到个人资料页
			$('#user_info').on('click', function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage("inquiry_userinfo.htm");
				}
			})
			//跳转到新手指南页
			$('#user_novice').on('click', function () {
				goPage("inquiry_novice.htm");
			})
			//跳转到收货地址页
			$('#user_address').on('click', function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage('inquiry_useraddress.htm?orgid=' + orgid + '&openid=' + openid + '&user_id=' + user_id);
				}
			})
			//跳转到隐私政策页
			$('#user_privacy').on('click', function () {
				goPage("inquiry_privacy.htm");
			})
			//跳转到修改密码页
			$('#user_password').on('click', function () {
				if (!isLogin()) {
					$.confirm("请先登录再操作", function () {
						goPage('login.htm');
					}, function () {
						//取消操作
					});
				} else {
					goPage("inquiry_user_password.htm");
				}
			})
			//	退出登录
			$("#my_exit").on("click", function () {
				checkLogin();
				$.confirm("您确定要退出吗?", "确认退出?", function () {
					newLogout()
				}, function () {
					//取消操作
				});
			});
			//我的医生未读消息小红点显示
			wsConnection.onMessage = function (msg) {
				if (msg.packageType == 40) {
					console.log(msg.isRead);
					//是否有未读消息0为不显示1为显示
					msgIsRead = msg.isRead
					if (msgIsRead == 0) {
						
					} else {
						$("#unreadIcon").show()
					}
				}
			}
		})

		function newGetInfo() {
			newAjaxPost("/h5/userInfo/userInfo", {}, newGetInfoOk);
		}

		function newGetInfoOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				var infoData = '',
					nickname, userimg;
				if (jsonInfo.data.userImg) {
					userimg = jsonInfo.data.userImg
					// $('#head_img img').attr({'src':userimg});
				} else {
					userimg = '../res/images/1.9.1img/img_user@2x.png'
					// updataImg()
				}
				if (jsonInfo.data.userNickname) {
					nickname = jsonInfo.data.userNickname
				} else {
					nickname = '未设置'
				}
				$('#head_img img').attr({
					'src': userimg
				});
				infoData += '<div>';
				infoData += '<span style="text-align:left; max-width:200px; margin:0 10px;">' + nickname + '</span>';
				infoData += '<span style="text-align: left;">' + jsonInfo.data.mobile + '</span>';
				infoData += '</div>'
				$('.userName').html(infoData);
			} else {
				$('#userInfo').on('click', function () {
					goPage('login.htm');
				})
			}
		}

		function updataImg() {
			var data = 'https://oss.yixianmedical.com/hospital/1610591980436.png'
			newAjaxPost("/h5/userInfo/updateUserHeadImg", {
				"userImg": data
			}, newUpdateUserHeadImgOk);
		}

		function newUpdateUserHeadImgOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				$('#head_img img').attr({
					'src': '../res/images/userImg.png'
				});
			}
		}

		function newLogout() {
			newAjaxPost("/h5/outLogin/out", {}, newLogoutOk);
		}

		function newLogoutOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				$.toast("退出成功!");
				sessionStorage.clear();
				localStorage.clear();
				location.reload();
			} else {
				$.toast(jsonInfo.msg);
			}
		}
	</script>
</head>
<style type="text/css">
	.top_title{
		position: relative;
		z-index: 1;
	}

	.section_padding{
		padding-bottom: 65px;
	}

	p {
		overflow: hidden;
		/*超出隐藏*/
		text-overflow: ellipsis;
		/*文本溢出时显示省略标记*/
		display: -webkit-box;
		/*设置弹性盒模型*/
		-webkit-line-clamp: 3;
		/*文本占的行数,如果要设置2行加...则设置为2*/
		-webkit-box-orient: vertical;
		/*子代元素垂直显示*/
	}

	/* 顶部栏 */
	.weui-btn_primary {
		background-color: transparent;
	}

	.weui-header .weui-header-title,
	.weui-header h1 {
		color: #ffffff;
	}

	.background_photo {
		width: 100%;
		z-index: -1;
	}

	.background_photo img{
		width: 100%;
		height: 80%;
	}

	.user_message{
		position: absolute;
		top: 0;
		width: 100%;
	}

	.reg {
		border-radius: 10px;
		background: #1189ff;
		color: #ffffff;
		padding: 0 5px;
		height: 30px;
		line-height: 30px;
	}

	.top_title .module_section{
		position: absolute;
		bottom: 8%;
		top: 51%;
	}
	
	.module_section {
		margin: 0 4%;
		padding: 15px;
		width: 92%;
		box-sizing: border-box;
		background-color: #fff;
		border-radius: 6px;
	}

	.title_text{
		margin-bottom: 10px;
		display: flex;
	}
	
	.title_text p{
		font-size: 15px;
		position: relative;
		top: -4px;
		left: 10px;
	}

	.title_icon{
		width: 6px;
		display: block;
	}

	.medical_service{
		display: flex;
		justify-content: space-around;
		text-align: center;
		height: 80%;
		align-items: center;
	}

	.service_icon{
		width: 29px;
		height: 35px;
	}

	.service_text{
		font-size: 13px;
	}

	.setting_list{
		display: grid;
    	grid-template-columns: repeat(4,25%);
		row-gap: 22px;
	}
	.setting_item{
		display: flex;
		flex-direction: column;
		align-items: center;
	}	
	.setting_item img{
		width: 26px;
		height: 26px;
		display: block;
	}
	.setting_item p{
		font-size: 13px;
	}

	.uni-list-cell-navigate {
		font-size: 16px;
		line-height: 30px;
		position: relative;
		display: block;
		box-sizing: border-box;
		width: 100%;
		flex: 1;
		justify-content: space-between;
		align-items: center;
	}

	.uni-list-cell-navigate span:after {
		content: " ";
		display: inline-block;
		height: 6px;
		width: 6px;
		border-width: 2px 2px 0 0;
		border-color: #C8C8CD;
		border-style: solid;
		-webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
		transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
		position: relative;
		top: -2px;
		position: absolute;
		top: 50%;
		margin-top: -4px;
		right: 13px;
	}

	#userInfo {
		display: flex;
		align-items: center;
		width: unset;
		text-align: center;
		color: #000000;
		margin: 5% 15px 0;
	}

	#head_img {
		border: 1px solid white;
		border-radius: 50%;
		width: 3.75rem;
		height: 3.75rem;
		overflow: hidden;
	}

	.userName {
		font-size: 1rem;
	}

	.userName div span{
		color: #fff;
	}

	#unreadIcon {
		height: 8px;
		width: 8px;
		background-color: red;
		border-radius: 50%;
		position: absolute;
		right: 40px;
	}

	#patients_list{
		display: none;
	}
</style>

<body ontouchstart>
	<!--头部-->
	<div class="fixed-top top_title">
		<div class="background_photo">
			<img src="../res/images/1.9.1img/img_bg@2x.png">
		</div>
		<div class="user_message">
			<div class="weui-btn_primary weui-header">
				<h1 class="weui-header-title">个人中心</h1>
			</div>
			<div id="userInfo">
				<div id="head_img"><img style="width:100%" src="../res/images/1.9.1img/img_user@2x.png" /></div>
				<div class="userName">
					<p class="reg">点击登录/注册</p>
				</div>
			</div>
		</div>
		<div class="module_section">
			<div class="module_title">
				<div class="title_text">
					<img class="title_icon" src="../res/images/1.9.1img/icon_decorate@2x.png">
					<p>医疗服务</p>
				</div>
			</div>
			<div class="medical_service">
				<div id="my_order">
					<img class="service_icon" src="../res/images/1.9.1img/icon_order@2x.png">
					<div class="service_text">订单中心</div>
				</div>
				<div id="my_recipe">
					<img class="service_icon" src="../res/images/1.9.1img/icon_prescription@2x.png">
					<div class="service_text">我的处方</div>
				</div>
				<div id="my_inquiry">
					<img class="service_icon" src="../res/images/1.9.1img/icon_consultation@2x(1).png">
					<div class="service_text">我的问诊</div>
				</div>
				<div id="examination_report" style="display: none;">
					<img class="service_icon" src="../res/images/icon_inspect.png">
					<div class="service_text">检查检验</div>
				</div>
			</div>
		</div>
	</div>
	<!--内容-->
	<section class="section_padding">
		
		<div class="module_section">
			<div class="module_title">
				<div class="title_text">
					<img class="title_icon" src="../res/images/1.9.1img/icon_decorate@2x.png">
					<p>常用设置</p>
				</div>
			</div>
			<div class="setting_list">
				<div class="setting_item" id="inquire_report">
					<img src="../res/images/1.9.1img/icon_consultation_select@2x.png">
					<p>查询报告</p>
				</div>
				<div class="setting_item" id="patients_list">
					<img src="../res/images/1.9.1img/icon_patients.png">
					<p>就诊人管理</p>
				</div>
				<div class="setting_item" id="user_info">
					<img src="../res/images/1.9.1img/icon_personal_data@2x.png">
					<p>个人资料</p>
				</div>
				<div class="setting_item" id="user_address">
					<img src="../res/images/1.9.1img/icon_address@2x.png">
					<p>收货地址</p>
				</div>
				<div class="setting_item"  id="user_password">
					<img src="../res/images/1.9.1img/icon_password@2x.png">
					<p>修改密码</p>
				</div>
				<div class="setting_item" id="user_novice">
					<img src="../res/images/1.9.1img/icon_help_center@2x.png">
					<p>帮助中心</p>
				</div>
				<div class="setting_item" id="user_privacy">
					<img src="../res/images/1.9.1img/icon_privacy_agreement@2x.png">
					<p>隐私协议</p>
				</div>
				<div class="setting_item" id="my_exit">
					<img src="../res/images/1.9.1img/icon_sign_out@2x.png">
					<p>退出登录</p>
				</div>
			</div>
		</div>
	</section>
	<!--脚部-->
	<div id='tb' class="weui-tab" style="height:auto;">
		<div class="weui-tabbar tab-bottom">
			<a href="javascript:;" class="weui-tabbar__item" id="inquiry_index">
				<span style="display: inline-block;position: relative;">
					<img src="../res/images/acitve_index.png" alt="" class="weui-tabbar__icon">
				</span>
				<p class="weui-tabbar__label">首页</p>
			</a>
			<a href="javascript:;" class="weui-tabbar__item" id="inquiry_doctor">
				<img src="../res/images/acitve_wz.png" alt="" class="weui-tabbar__icon">
				<p class="weui-tabbar__label">问诊</p>
			</a>
			<a href="javascript:;" class="weui-tabbar__item" id="my_doctor_index">
				<span style="display: inline-block;position: relative;">
					<img src="../res/images/icon_doctor.png" class="weui-tabbar__icon">
				</span>
				<span id="unreadIcon" style="display: none;"></span>
				<p class="weui-tabbar__label ">我的医生</p>
			</a>
			<a href="javascript:;" class="weui-tabbar__item" id="inquiry_user_per">
				<img src="../res/images/per_icon.png" class="weui-tabbar__icon">
				<p class="weui-tabbar__label f-blue">我的</p>
			</a>
		</div>
	</div>
</body>

</html>